package com.ituzhi.mqtt.server.handler;

import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.MessagingException;
import org.springframework.stereotype.Component;

/**
 * packageName com.ituzhi.mqtt.handler
 *
 * @author 死道友不死贫道
 * @version JDK 17
 * @className ReceiverMessageHandler
 * @date 2025-01-23
 * @description TODO
 */
@Component
public class ReceiverMessageHandler implements MessageHandler {

    @Override
    public void handleMessage(Message<?> message) throws MessagingException {
        Object payload = message.getPayload();
        System.out.println("接收到消息：" + payload);
        MessageHeaders headers = message.getHeaders();
        System.out.println("topicName:" + headers.get("mqtt_receivedTopic"));
    }
}